﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserRight.aspx.cs" Inherits="System_UserRight" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>模块权限设置</title>
    <link href="../../CSS/css.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript" src="../../js/JS_common.js"></script>
    <script language="javascript" type="text/javascript" src="../../js/GeneralPage.js"></script>
    <script language="javascript" type="text/javascript" src="../../js/JS_selectall.js"></script>
    <script language="javascript" type="text/javascript">
        function selectAll(cbName,cbStartName)
        {
            var o = document.getElementsByTagName("input");
            var selall = document.getElementById(cbName);

            for(var i = 0;i <o.length;i++)
            {
                if(o[i].id.indexOf(cbStartName)>=0)
                {
                    if(selall.checked == true)
                        o[i].checked = true;
                    else
                        o[i].checked = false;
                }
            }
        }

        function selectAllUser(cbName,cbStartName)
        {
            $("BtnSelectAllUser").click();
            selectAll(cbName,cbStartName);
        }
    </script>    
</head>
<body onkeydown="KeyClick('btnRinght')">
    <form id="form1" runat="server">
        <div id="MainContent">
            <div id="mcTitle" class="tit">模块权限设置</div>
            <div class="con">
            <div class="btnDiv">
                <table class="CommonPage_table" >
                    <tr >
                        <td >
                            <input id="txUserInfo" runat="server" title="按照帐号姓名查询相关用户" /> &nbsp;<input id="btnRinght" class="buttonface" type="button" runat="server" value="查  询" onserverclick="btnRinght_ServerClick" />
                        </td>
                        <td>
                            <input type="checkbox" id="CB_AllUser"  onclick="selectAllUser('CB_AllUser','CB_selectToSet');" runat="server"/><label for="CB_AllUser">当前全部用户</label>
                        </td>
                        <td><input type="checkbox" id="CB_AllModul" onclick="selectAll('CB_AllModul','tvModuleRight');" /><label for="CB_AllModul">全部模块</label></td>
                        <td><input type="checkbox" id="CB_AllCity" onclick="selectAll('CB_AllCity','tvCityRight');" /><label for="CB_AllCity">全部操作</label></td>
                    </tr>
                    <tr>
                        <td style="width:260px" valign="top">
                            <div>分公司信息</div>
                            <div style=" background-color:0099CC; PADDING-RIGHT:10px;OVERFLOW-Y:auto;PADDING-LEFT:10px;SCROLLBAR-FACE-COLOR:0099CC;FONT-SIZE:11pt;PADDING-BOTTOM:0px;SCROLLBAR-HIGHLIGHT-COLOR:0099CC;OVERFLOW:auto;SCROLLBAR-SHADOW-COLOR:#919192;COLOR:blue;SCROLLBAR-3DLIGHT-COLOR:#ffffff;LINE-HEIGHT:100%;SCROLLBAR-ARROW-COLOR:#919192;PADDING-TOP:0px;SCROLLBAR-TRACK-COLOR:#ffffff;SCROLLBAR-DARKSHADOW-COLOR:#ffffff;LETTER-SPACING:1pt;HEIGHT:550px;WIDTH:150px;TEXT-ALIGN:left">  
                              <asp:TreeView ID="tvUser" runat="server"  onclick="HandleCheckEvent();" OnSelectedNodeChanged="tvUser_SelectedNodeChanged" ShowLines="true">
                              </asp:TreeView>
                            </div>
                            
                        </td>
                        <td style="width:300px" valign="top">
                            <div>用户信息</div>
<%--                            <div style=" background-color:0099CC; PADDING-RIGHT:5px;OVERFLOW-Y:auto;PADDING-LEFT:5px;SCROLLBAR-FACE-COLOR:0099CC;FONT-SIZE:9pt;PADDING-BOTTOM:0px;SCROLLBAR-HIGHLIGHT-COLOR:0099CC;OVERFLOW:auto;SCROLLBAR-SHADOW-COLOR:#919192;COLOR:blue;SCROLLBAR-3DLIGHT-COLOR:#ffffff;LINE-HEIGHT:100%;SCROLLBAR-ARROW-COLOR:#919192;PADDING-TOP:0px;SCROLLBAR-TRACK-COLOR:#ffffff;SCROLLBAR-DARKSHADOW-COLOR:#ffffff;LETTER-SPACING:1pt;HEIGHT:550px;WIDTH:300px;TEXT-ALIGN:left">  
--%>
                            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
                                SelectCommand="SELECT * FROM V_TAB_USER order by company, department desc" >
                            </asp:SqlDataSource>
                            <asp:GridView ID="GridViewUserList" runat="server" AutoGenerateColumns="false" DataKeyNames="USERACCOUNT" PageSize="18" Width="100%" CellPadding="3" font-size="9pt" BackColor="White" BorderColor="#CCCCCC" BorderStyle="none" BorderWidth="1px" AllowPaging="true" 
                             OnPageIndexChanging="GridViewUserList_PageIndexChanging" OnRowCommand="GridViewUserList_RowCommand" OnRowDataBound="GridViewUserList_RowDataBound" DataSourceID="SqlDataSource1" AllowSorting="true" OnSorting="GridViewUserList_OnSorting">
                                 <Columns>
                                    <asp:TemplateField HeaderText="显示">
                                        <HeaderTemplate>
                                            <input id="cb_selectAll" type="checkbox" onclick="selectAll('cb_selectAll','CB_selectToSet');" />
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:CheckBox ID ="CB_selectToSet" runat="server" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="帐号" SortExpression="USERACCOUNT" >
                                        <ItemTemplate>
                                            <asp:LinkButton ID="LB_USERACCOUNT" ToolTip="点击查看当前用户的权限" runat="server" CausesValidation="False" CommandName="ToShowUserRight" Text="<%# Bind('USERACCOUNT')%>" CommandArgument="<%#((GridViewRow) Container).RowIndex %>" style="TEXT-DECORATION: none"></asp:LinkButton>
                                        </ItemTemplate>
                                        <ItemStyle Wrap="False" />
                                    </asp:TemplateField>                                       
                                    <asp:TemplateField HeaderText="姓名" SortExpression="USERNAME" >
                                        <ItemTemplate>
                                            <asp:LinkButton ID="LB_USERNAME" ToolTip="点击查看当前用户的权限" runat="server" CausesValidation="False" CommandName="ToShowUserRight" Text="<%# Bind('USERNAME')%>" CommandArgument="<%#((GridViewRow) Container).RowIndex %>" style="TEXT-DECORATION: none"></asp:LinkButton>
                                        </ItemTemplate>
                                        <ItemStyle Wrap="False" />
                                    </asp:TemplateField>                                       
                                 </Columns>
                                    <EmptyDataTemplate>无相关用户信息</EmptyDataTemplate>
                                    <FooterStyle Font-Bold="True" ForeColor="White" />
                                    <PagerStyle HorizontalAlign="left" />
                                    <HeaderStyle Font-Bold="True" BackColor="#C1C1C1" />
                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                    <PagerSettings Mode="NumericFirstLast" FirstPageText="首页" LastPageText="末页" Visible="false" /> 
                            </asp:GridView>
                            <table id="Table2" align="center" border="0" width="100%">
                                <tbody id ="ToVis" runat="server">
                                    <tr>
                                        <td align="left" class="font4" style="height: 18px">
                                            共
                                            <asp:Label ID="lblAllRow" runat="server" Text="Label" Width="10px"></asp:Label>&nbsp;
                                            条&nbsp;&nbsp;
                                            <asp:LinkButton ID="LbtFirstPage" runat="server" OnClick="FirstPageClick">首页</asp:LinkButton>&nbsp;
                                            <asp:LinkButton ID="LbtPreviousPage" runat="server" OnClick="PreviousPageClick">上一页</asp:LinkButton>&nbsp;
                                            <asp:LinkButton ID="LbtNextPage" runat="server" OnClick="NextPageClick">下一页</asp:LinkButton>&nbsp;
                                            <asp:LinkButton ID="LbtLastPage" runat="server" OnClick="LastPageClick">尾页</asp:LinkButton>&nbsp;
                                        </td>
                                    </tr>
                                </tbody>
                            </table>                                              
<%--                            </div>
--%>                        </td>
                        <td style="width:250px" valign="top">
                            <div>功能模块权限</div>
                            <div style=" background-color:0099CC; PADDING-RIGHT:10px;OVERFLOW-Y:auto;PADDING-LEFT:10px;SCROLLBAR-FACE-COLOR:0099CC;FONT-SIZE:11pt;PADDING-BOTTOM:0px;SCROLLBAR-HIGHLIGHT-COLOR:0099CC;OVERFLOW:auto;SCROLLBAR-SHADOW-COLOR:#919192;COLOR:blue;SCROLLBAR-3DLIGHT-COLOR:#ffffff;LINE-HEIGHT:100%;SCROLLBAR-ARROW-COLOR:#919192;PADDING-TOP:0px;SCROLLBAR-TRACK-COLOR:#ffffff;SCROLLBAR-DARKSHADOW-COLOR:#ffffff;LETTER-SPACING:1pt;HEIGHT:550px;WIDTH:300px;TEXT-ALIGN:left">  
                              <asp:TreeView ID="tvModuleRight" runat="server" ShowCheckBoxes="All"  onclick="HandleCheckEvent();" >
                              </asp:TreeView>
                            </div>
                        </td>
                        <td style="width:250px" valign="top">
                            <div>操作权限</div>
                            <div style=" background-color:0099CC; PADDING-RIGHT:10px;OVERFLOW-Y:auto;PADDING-LEFT:10px;SCROLLBAR-FACE-COLOR:0099CC;FONT-SIZE:11pt;PADDING-BOTTOM:0px;SCROLLBAR-HIGHLIGHT-COLOR:0099CC;OVERFLOW:auto;SCROLLBAR-SHADOW-COLOR:#919192;COLOR:blue;SCROLLBAR-3DLIGHT-COLOR:#ffffff;LINE-HEIGHT:100%;SCROLLBAR-ARROW-COLOR:#919192;PADDING-TOP:0px;SCROLLBAR-TRACK-COLOR:#ffffff;SCROLLBAR-DARKSHADOW-COLOR:#ffffff;LETTER-SPACING:1pt;HEIGHT:550px;WIDTH:200px;TEXT-ALIGN:left">  
                              <asp:TreeView ID="tvCityRight" runat="server" ShowCheckBoxes="All" onclick="HandleCheckEvent();" >
                              </asp:TreeView>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td></td><td></td>
                        <td align="left">
                            <asp:Button ID="BT_UpdateModuleRight" runat="server" Text="提  交" CommandArgument="0" OnClick="SetModuleRight" class="buttonface"/>
                            <asp:Button ID="BT_AddModuleRight" runat="server" Text="增  加" CommandArgument="1" OnClick="SetModuleRight" class="buttonface"/>
                            <asp:Button ID="BT_DeleteModuleRight" runat="server" Text="去  除" CommandArgument="2" OnClick="SetModuleRight" class="buttonface"/>
                        </td>
                        <td align="left">
                            <asp:Button ID="BT_UpdateCityRight" runat="server" Text="提  交" CommandArgument="0" OnClick="SetCityRight" class="buttonface"/>
                            <asp:Button ID="BT_AddCityRight" runat="server" Text="增  加" CommandArgument="1" OnClick="SetCityRight" class="buttonface"/>
                            <asp:Button ID="BT_DeleteCityRight" runat="server" Text="去  除" CommandArgument="2" OnClick="SetCityRight" class="buttonface"/>
                        </td>
                    </tr>
                </table>
            </div>
            </div>
        </div>
        <div>
            <input runat="server" id="txUserId" type="text" style=" visibility:hidden"/>
            <input runat="server" id="txAction" type="text" style=" visibility:hidden"/>
            <input runat="server" id="txCityAction" type="text" style=" visibility:hidden"/>
        </div>
        <div style="display:none">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>        
        
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:Button ID="BtnSelectAllUser" runat="server" Text="选择或取消全部" OnClick="BtnSelectAllUser_Click" />
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
                
    </form>
</body>
</html>